#ifndef _UNI_HAL_ADC_H_
#define _UNI_HAL_ADC_H_

#include "ftadc.h"
#include <stdint.h>

int uni_hal_adc_init(void);
int uni_hal_adc_init_irq(void);
int uni_hal_register_callback(u8 channel, adc_callback func);

/*********************************************************************************************
channel: just support channel-2 and channel-3
thre_event_num: range 0~15
is_high_thre: 1:high, 0:low
thre_value: range (0~0xfff)
  when is_high_thre = 1:over thre_value will trigger interrupt, 0xfff will disable the function
  when is_high_thre = 0:below threshold threshold_l trigger interrupt, 0x0000 will disable the function
**********************************************************************************************/
int uni_hal_adc_config_channel(u8 channel, int event_index, u8 thres_type, u16 thres_value);

/*********************************************************************************************
channel: just support channel-2 and channel-3
debounce_count: how much count to trigger cb
debounce_gap: the value detla in gap will countdown debounce_count
**********************************************************************************************/
void uni_hal_adc_set_debounce(u8 channel, int debounce_count, int debounce_gap);

/*********************************************************************************************
channel: just support channel-2 and channel-3
value: range 0~4095
**********************************************************************************************/
int uni_hal_adc_get_value(u8 channel, int *value);

void uni_hal_adc_start(void);
void uni_hal_adc_stop(void);
int uni_hal_adc_final(void);

#endif
